<?php
    defined('SYSPATH') OR die('No direct access allowed.');

    function errorHandler($errno, $errstr, $errfile, $errline) {
        throw new Exception($errstr, $errno);
    }

    set_error_handler('errorHandler');

    if (! isset($registeredScripts)) $registeredScripts = array();
    if (! isset($registeredStyles))  $registeredStyles  = array();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>
            <?php echo html::specialchars($title); ?>
        </title>

        <script type="text/JavasScript">
            onLoadFunctions = new Array();
            onUnloadFunctions = new Array();

            function registerOnLoadFunction(functionName)
            {
                onLoadFunctions.push(functionName);
            }

            function registerOnUnloadFunction(functionName)
            {
                onUnloadFunctions.push(functionName);
            }

            function callRegisteredLoadFunctions()
            {
                for (functionName in onLoadFunctions)
                {
                    functionName();
                }
            }

            function callRegisteredUnloadFunctions()
            {
                for (functionName in onUnloadFunctions)
                {
                    functionName();
                }
            }
        </script>

        <style type="text/css">
            @import url("<?php echo URI_ROOT . "/css/style.css"; ?>");
        </style>

        <?php foreach ($registeredScripts as $scriptName): ?>
            <script type="text/JavaScript" src="<?php echo $ScriptName; ?>"></script>
        <?php endforeach; ?>

        <style type="text/css">
            <?php foreach ($registeredStyles as $styleName): ?>
                @import url("<?php echo styleName; ?>")
            <?php endforeach; ?>
        </style>

    </head>
    <!--onLoad="javascript:callRegisteredLoadFunctions();" onUnload="javascript:callRegisteredUnloadFunctions();"-->
    <body>

        <div id="header" onmouseover="this.style.opacity=1.0; this.style.filter='alpha(opacity=100)';" onmouseout="this.style.opacity=0.4; this.style.filter='alpha(opacity=40)';">
            <a href="<?php echo DOCROOT; ?>">
                <img src="<?php echo URI_ROOT . "/images/banner.png";?>" />
            </a>
            <h1>
                Some text here
            </h1>
        </div>

        <div id="container">
            <?php echo $content ?>
        </div>

        <div id="footer" onmouseover="this.style.opacity=1.0; this.style.filter='alpha(opacity=100)';" onmouseout="this.style.opacity=0.4; this.style.filter='alpha(opacity=40)';">
            <div style="float:right;">
                <a href="http://forums.eventscripts.com/" target="_blank">
                    <img src="<?php echo URI_ROOT . "/images/powered_by_eventscripts.png";?>" />
                </a>
            </div>
        </div>
        <!-- Rendered in {execution_time} seconds, using {memory_usage} of memory -->
    </body>
</html>